<?php
/**
 * 数据挖掘控制器
 *
 */
class UsercollectController extends BaseController
{
        /*
         * 
         * 数据挖掘页面的显示
         */
      public function run()
        { 
          // 查询userproduct
          $userProduct = UserProduct_Inquire::getInstance()->getUserProuct();
          include TPL_DIR . 'userDig.php';
        }
         public function userCollect() {
             
            //查询时间短，产品名的过滤验证
            $startTime = $this->getParamString('begintime');
            $stopTime  = $this->getParamString('endtime');
            $PName     = $this->getParamString('productName');
            $cache     = UserProduct_Collect::getInstance() -> getCacheValue () ;
            
            //获取查询产品的ID
            $productInfo = Product_Detail::getProduccInfo($PName) ;
            $productId = $productInfo [ 'PId' ] ;

            $cache = UserProduct_Collect::getInstance() -> getCacheValue () ;
            
            //print_r($cache);
            
            $arrayUId = array ( ) ;
            foreach ($cache as $key => $value) {

            if ( $key > $startTime && $key < $stopTime ) {
//                print_r($value);
                foreach ($value as $keys => $valueuid) {
                    
                    if ( $keys == $productId ) {
                        $arrayUId[  ] = $valueuid [ 'UId' ] ;
                    }
                    
                }
                
            }
                        
        }
        
        $result = array_unique ( $arrayUId ) ;
     
        $userInfo = array () ;
        
        foreach ($result as $value) {
            
              $userInfo[] = User_Info::getUser($value) ;
            
        }
        
        $userProduct = UserProduct_Inquire::getInstance()->getUserProuct();
        include TPL_DIR . 'userDig.php';
    }
}     